//
//  HXMeViewController.m
//  KD
//
//  Created by ifly on 16/3/16.
//  Copyright © 2016年 Whx. All rights reserved.
//

#import "HXMeViewController.h"
#import "HXAskOpinionTableViewController.h"
#import "HXUserDetailsViewController.h"

@interface HXMeViewController ()
@property (weak, nonatomic) IBOutlet UIView *editionView;
@property (weak, nonatomic) IBOutlet UILabel *editionTime;
@property (weak, nonatomic) IBOutlet UITextView *editionContent;
@property (nonatomic,copy) NSString * editionUrl;
@property (nonatomic,copy)NSString * editionNow;
@end

@implementation HXMeViewController

-(void)viewDidLoad {
    [super viewDidLoad];
    self.editionView.hidden = YES;
    self.editionContent.editable = NO;
    
    //设置当前版本号
    _editionNow = @"1.0.4";
}

- (IBAction)personalInformationBtn:(UIButton *)sender {
    
    UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Me" bundle:nil];
    UINavigationController * nvc = [storyBoard instantiateViewControllerWithIdentifier:@"HXUserDetailsViewController"];
    
    [self.navigationController pushViewController:nvc animated:YES];
}


- (IBAction)askOpinionBtn:(UIButton *)sender {
    
    HXAskOpinionTableViewController * vc = [[HXAskOpinionTableViewController alloc] init];
    
    [self.navigationController pushViewController:vc animated:YES];
}


/**
- (IBAction)cancelButton:(UIButton *)sender {
    self.editionView.hidden = YES;
}

- (IBAction)editionButton:(UIButton *)sender {
    self.editionView.hidden = YES;
    
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:_editionUrl]];
    
}

- (IBAction)editionChange:(UIButton *)sender {
        //获取当前版本号
        [NetworkAPI getNowEditionSuccess:^(HXNowEditionModel *result) {
            if ([result.code isEqualToString:@"400"]) {
                NSLog(@"暂无数据");
            }
            if ([result.code isEqualToString:@"200"]) {
                if ([result.details.VersionCode isEqualToString:_editionNow]) {
                    NSLog(@"版本相同,无需更新");
                    
                    UIAlertController *editionAlertController = [UIAlertController alertControllerWithTitle:@"相关描述" message:@"已是最新版本,不用更新" preferredStyle:UIAlertControllerStyleAlert];
                    
                    UIAlertAction *cretainButtn=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                        //点击按钮之后 回调的bolck
                    }];
                    [editionAlertController addAction:cretainButtn];
                    
                    [self presentViewController:editionAlertController animated:YES completion:^{
                        
                    }];
                }
                if (![result.details.VersionCode isEqualToString:_editionNow]) {
                    self.editionView.hidden = NO;
                    _editionTime.text = [NSString stringWithFormat:@"更新时间:%@",result.details.VersionDate];
                    _editionContent.text = [NSString stringWithFormat:@"更新内容:%@",result.details.VersionText];
                    _editionUrl = [NSString stringWithFormat:@"%@",result.details.VersionUrl];
                }
            }
        } failure:^(NSError *err) {
            
        }];
}
*/




@end
